package com.hontlong.aixue.dao;

import java.sql.SQLException;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.stereotype.Component;

import com.hontlong.aixue.bean.User;

@Component
public class UserDao extends HibernateDaoSupport {
	public void add(final User user) {
		getHibernateTemplate().execute(new HibernateCallback() {
			public Object doInHibernate(Session session)
					throws HibernateException, SQLException {
				session.beginTransaction();
				session.save(user);
				session.getTransaction().commit();
				return null;
			}
		});
	}
}
